#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

#define M 10

void star_1()
{
    int outer;
    int inner;

    for(outer = 1; outer < 11; outer++){
        for(inner = 1; inner <= outer; inner++){
            printf("%c",'*');
        }
        printf("\n");
    }
}

void star_2()
{
    int outer;
    int inner;

    for(outer = 10; outer > 0; outer--){
        for(inner = outer; inner > 0; inner--){
            printf("%c", '*');
        }
        printf("\n");
    }
}

void star_3()
{
    int outer;
    int inner;

    for(outer = -4; outer <= 4; outer++){
        for(inner = 1; inner <= (5 - abs(outer)); inner++){
            printf("*");
        }
        for(;inner <= 5; inner ++){
            printf(" ");
        }
        printf("\n");
    }
}

void star_4()
{
    int outer;
    int inner;

    for(outer = -4; outer <= 4; outer++){
        for(inner = 1; inner <= abs(outer); inner ++){
            printf(" ");
        }
        for(;inner <= 5; inner ++){
            printf("*");
        }
        printf("\n");
    }
}

void star_5()
{
    int outer;
    int inner;

    for(outer = -4; outer <= 4; outer++){                    // [-4,4]代表菱形最宽处的宽度，inner里的那个5 是菱形两边各有多少
        for(inner = -4; inner < abs(outer)-4;inner++){
            printf(" ");
        }
        for(;inner <= 4-abs(outer); inner++){
            printf("*");
        }
        printf("\n");
    }
}

void star_6()
{
    int outer;
    int inner;

    for(outer = -9; outer <= 0; outer ++){
        for(inner = outer; inner < 0; inner ++){
            printf(" ");
        }

        for(; inner <= 9; inner ++){
            printf("*");
        }

        printf("\n");
    }
}

void star_7()
{
    int outer;
    int inner;
    int k;

    printf("line:  1");
    for(outer = -9; outer<=9; outer++){
        printf("%3d",outer);
    }
    printf("\n");
    for(outer = -9; outer <= 9; outer++){
        printf("line: %2d", outer);
        for(inner = -9; inner < abs(outer)-9; inner++)
            printf("   ");
        for(k = 1;inner < 0 || inner == 0; inner++, k++ ){
            printf("%3d",k);
        }
        //printf("%12d",k);
        //k=k-1;
        //k = 0;
        k--;
        while(--k){
            printf("%3d",k);
            //k = k - 1;
        }
        printf("\n");
    }
}

void star_8(void)
{
    int a[M][M], i , j ;
    for(i=0; i<M; i++)
    {
        for(j=0; j<=i; j++)
        {
            if(i==j||j==0)
                a[i][j]=1;
            else
                a[i][j]=a[i-1][j]+a[i-1][j-1];
            printf("%d ",a[i][j]);
        }
        printf("\n");
    }
    printf("\n");
}



int main()
{
    int a=0;
    //star_1();
    //star_2();
    star_8();
    //cout << a <<endl;
    return 0;
}
